//
//  JCMoreViewController.m
//  ABookOfCartoon
//
//  Created by 美国大狗 on 15-5-13.
//  Copyright (c) 2015年 Power Of Ants. All rights reserved.
//

#import "JCMoreViewController.h"
#import "JCSecondViewController.h"
#import "JCThreeViewController.h"
#import "JCForViewController.h"
#import "UMFeedback.h"

@interface JCMoreViewController ()<UIScrollViewDelegate>

@end

@implementation JCMoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = YES;
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"更多";
    
    
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top1"]];
    imageView.frame = CGRectMake(0, ScreenFramS/10, ScreenFramF/4, ScreenFramS/8);
    [self.view addSubview:imageView];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    [button setTitle:@"亮度调节" forState:UIControlStateNormal];
    button.backgroundColor = [UIColor whiteColor];
    button.frame = CGRectMake(ScreenFramF/4, ScreenFramS/10, ScreenFramF/3, ScreenFramS/10);
    
    button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
    [button addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    
    //缓存
    
    
    UIImageView *imageVIew1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top4"]];
    imageVIew1.frame = CGRectMake(ScreenFramF - ScreenFramF/4, ScreenFramS/4, ScreenFramF/4  , ScreenFramS/8);
    [self.view addSubview:imageVIew1];
    
    
    UIButton *buttonhuancun = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonhuancun.backgroundColor = [UIColor whiteColor];
    buttonhuancun.frame = CGRectMake(ScreenFramF - ScreenFramF/2.2, ScreenFramS/4, ScreenFramF/4, ScreenFramS/10);
    
    //字体颜色
    [buttonhuancun setTitleColor:[UIColor cyanColor] forState:UIControlStateNormal];
    ;
    [buttonhuancun setTitle:@"清除缓存" forState:UIControlStateNormal];
    [buttonhuancun addTarget:self action:@selector(butaction:) forControlEvents:UIControlEventTouchUpInside];
    buttonhuancun.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
    
    [self.view addSubview:buttonhuancun];
    
    
    
    
    //意见反馈
    
    UIImageView *imageVIew2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top2"]];
    imageVIew2.frame =  CGRectMake(0, ScreenFramS/4 +ScreenFramS/8, ScreenFramF/4, ScreenFramS/8);
    [self.view addSubview:imageVIew2];
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeSystem];
    
    button1.backgroundColor = [UIColor whiteColor];
    button1.frame = CGRectMake(ScreenFramF/4, ScreenFramS/2.6, ScreenFramF/3, ScreenFramS/10);
    
    [button1 setTitle:@"意见反馈" forState:UIControlStateNormal];
    button1.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft ;
    [button1 addTarget:self action:@selector(button1:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    
    
    
    
    UIImageView *imageVIew3 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top3"]];
    imageVIew3.frame =  CGRectMake(ScreenFramF - ScreenFramF/4, ScreenFramS/2, ScreenFramF/4, ScreenFramS/8);
    [self.view addSubview:imageVIew3];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
    button2.backgroundColor = [UIColor whiteColor];
    
    button2.frame = CGRectMake(ScreenFramF - ScreenFramF/2.2, ScreenFramS/2, ScreenFramF/4.4, ScreenFramS/10);
    
    [button2 setTitle:@"关于我们" forState:UIControlStateNormal];
    button2.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft ;
    [button2 addTarget:self action:@selector(button2:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button2];
    
}
- (void)butaction:(UIButton *)button
{
    NSInteger size = [[SDImageCache sharedImageCache] getSize];
    float flSize = size /1024.0 /1024.0;
    self.str = [NSString stringWithFormat:@"%.2f.M",flSize];
    
    
    UIAlertView *aview = [[UIAlertView alloc] initWithTitle:@"共有缓存" message:self.str delegate:self cancelButtonTitle:nil
                                          otherButtonTitles:@"干掉它们!", nil];
    [aview show];
    //清除磁盘缓存
    [[SDImageCache sharedImageCache] clearDisk];
    //清除内存缓存
    [[[SDWebImageManager sharedManager] imageCache] clearMemory];
    
    //清除系统缓存
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    
    [aview release];
    
}
- (void)button:(UIButton *)button
{
    JCSecondViewController *secondVC = [[JCSecondViewController alloc]init];
    [self.navigationController pushViewController:secondVC animated:YES];
}
- (void)button1:(UIButton *)button
{
//    [self.navigationController pushViewController:[UMFeedback feedbackViewController]animated:YES];
    [self.navigationController pushViewController:[UMFeedback feedbackViewController] animated:YES];
}
- (void)button2:(UIButton *)button
{
    JCForViewController *forVC = [[JCForViewController alloc]init];
    [self.navigationController pushViewController:forVC animated:YES];
    
}
- (void)button3
{
    UIAlertView *sb = [[UIAlertView alloc] initWithTitle:@"提示" message:@"已经是最新版本(v1.01)啦!" delegate:self cancelButtonTitle:@"哦" otherButtonTitles: nil];
    [sb show];
    [sb release];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end